<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtWebApp: stefanfrings::HttpSessionStore Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QtWebApp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classstefanfrings_1_1HttpSessionStore.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#signals">Signals</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classstefanfrings_1_1HttpSessionStore-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">stefanfrings::HttpSessionStore Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Stores HTTP sessions and deletes them when they have expired.  
 <a href="classstefanfrings_1_1HttpSessionStore.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="httpsessionstore_8h_source.html">httpsessionstore.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for stefanfrings::HttpSessionStore:</div>
<div class="dyncontent">
<div class="center"><img src="classstefanfrings_1_1HttpSessionStore__inherit__graph.png" border="0" usemap="#astefanfrings_1_1HttpSessionStore_inherit__map" alt="Inheritance graph"/></div>
<map name="astefanfrings_1_1HttpSessionStore_inherit__map" id="astefanfrings_1_1HttpSessionStore_inherit__map">
<area shape="rect" title="Stores HTTP sessions and deletes them when they have expired." alt="" coords="5,80,192,121"/>
<area shape="rect" title=" " alt="" coords="61,5,136,32"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for stefanfrings::HttpSessionStore:</div>
<div class="dyncontent">
<div class="center"><img src="classstefanfrings_1_1HttpSessionStore__coll__graph.png" border="0" usemap="#astefanfrings_1_1HttpSessionStore_coll__map" alt="Collaboration graph"/></div>
<map name="astefanfrings_1_1HttpSessionStore_coll__map" id="astefanfrings_1_1HttpSessionStore_coll__map">
<area shape="rect" title="Stores HTTP sessions and deletes them when they have expired." alt="" coords="5,80,192,121"/>
<area shape="rect" title=" " alt="" coords="61,5,136,32"/>
</map>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="signals"></a>
Signals</h2></td></tr>
<tr class="memitem:ace45645f705afa06389fb62b78dcc069"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#ace45645f705afa06389fb62b78dcc069">sessionDeleted</a> (const QByteArray &amp;sessionId)</td></tr>
<tr class="memdesc:ace45645f705afa06389fb62b78dcc069"><td class="mdescLeft">&#160;</td><td class="mdescRight">Emitted when the session is deleted.  <a href="classstefanfrings_1_1HttpSessionStore.html#ace45645f705afa06389fb62b78dcc069">More...</a><br /></td></tr>
<tr class="separator:ace45645f705afa06389fb62b78dcc069"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a6fe27af9d600bdb5981ce10587ad84dd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#a6fe27af9d600bdb5981ce10587ad84dd">HttpSessionStore</a> (const QSettings *settings, QObject *parent=nullptr)</td></tr>
<tr class="memdesc:a6fe27af9d600bdb5981ce10587ad84dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="classstefanfrings_1_1HttpSessionStore.html#a6fe27af9d600bdb5981ce10587ad84dd">More...</a><br /></td></tr>
<tr class="separator:a6fe27af9d600bdb5981ce10587ad84dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a06062155c1dc31ede2cbc5f31bce4df3"><td class="memItemLeft" align="right" valign="top"><a id="a06062155c1dc31ede2cbc5f31bce4df3"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#a06062155c1dc31ede2cbc5f31bce4df3">~HttpSessionStore</a> ()</td></tr>
<tr class="memdesc:a06062155c1dc31ede2cbc5f31bce4df3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a06062155c1dc31ede2cbc5f31bce4df3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf9147137698db03b322ea93de548fba"><td class="memItemLeft" align="right" valign="top">QByteArray&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#aaf9147137698db03b322ea93de548fba">getSessionId</a> (<a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;request, <a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;response)</td></tr>
<tr class="memdesc:aaf9147137698db03b322ea93de548fba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the ID of the current HTTP session, if it is valid.  <a href="classstefanfrings_1_1HttpSessionStore.html#aaf9147137698db03b322ea93de548fba">More...</a><br /></td></tr>
<tr class="separator:aaf9147137698db03b322ea93de548fba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8b334fa7cf51e411039f0256eda90d6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classstefanfrings_1_1HttpSession.html">HttpSession</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#af8b334fa7cf51e411039f0256eda90d6">getSession</a> (<a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;request, <a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;response, const bool allowCreate=true)</td></tr>
<tr class="memdesc:af8b334fa7cf51e411039f0256eda90d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the session of a HTTP request, eventually create a new one.  <a href="classstefanfrings_1_1HttpSessionStore.html#af8b334fa7cf51e411039f0256eda90d6">More...</a><br /></td></tr>
<tr class="separator:af8b334fa7cf51e411039f0256eda90d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab197132dc4713cd647705d09c9f84ba8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classstefanfrings_1_1HttpSession.html">HttpSession</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#ab197132dc4713cd647705d09c9f84ba8">getSession</a> (const QByteArray id)</td></tr>
<tr class="memdesc:ab197132dc4713cd647705d09c9f84ba8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a HTTP session by it's ID number.  <a href="classstefanfrings_1_1HttpSessionStore.html#ab197132dc4713cd647705d09c9f84ba8">More...</a><br /></td></tr>
<tr class="separator:ab197132dc4713cd647705d09c9f84ba8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a34db6bdec51d2e6f68528391a36165f4"><td class="memItemLeft" align="right" valign="top"><a id="a34db6bdec51d2e6f68528391a36165f4"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#a34db6bdec51d2e6f68528391a36165f4">removeSession</a> (const <a class="el" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> session)</td></tr>
<tr class="memdesc:a34db6bdec51d2e6f68528391a36165f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete a session. <br /></td></tr>
<tr class="separator:a34db6bdec51d2e6f68528391a36165f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a25bcdad5accd436881927a414b99ba22"><td class="memItemLeft" align="right" valign="top"><a id="a25bcdad5accd436881927a414b99ba22"></a>
QMap&lt; QByteArray, <a class="el" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html#a25bcdad5accd436881927a414b99ba22">sessions</a></td></tr>
<tr class="memdesc:a25bcdad5accd436881927a414b99ba22"><td class="mdescLeft">&#160;</td><td class="mdescRight">Storage for the sessions. <br /></td></tr>
<tr class="separator:a25bcdad5accd436881927a414b99ba22"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Stores HTTP sessions and deletes them when they have expired. </p>
<p>The following configuration settings are required in the config file: <code></p><pre>
expirationTime=3600000
cookieName=sessionid
</pre><p></code> The following additional configurations settings are optionally: <code></p><pre>
cookiePath=/
cookieComment=Session ID
;cookieDomain=stefanfrings.de
</pre><p></code> </p>

<p class="definition">Definition at line <a class="el" href="httpsessionstore_8h_source.html#l00035">35</a> of file <a class="el" href="httpsessionstore_8h_source.html">httpsessionstore.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a6fe27af9d600bdb5981ce10587ad84dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6fe27af9d600bdb5981ce10587ad84dd">&#9670;&nbsp;</a></span>HttpSessionStore()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">HttpSessionStore::HttpSessionStore </td>
          <td>(</td>
          <td class="paramtype">const QSettings *&#160;</td>
          <td class="paramname"><em>settings</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QObject *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>nullptr</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">settings</td><td>Configuration settings, usually stored in an INI file. Must not be 0. Settings are read from the current group, so the caller must have called settings-&gt;beginGroup(). Because the group must not change during runtime, it is recommended to provide a separate QSettings instance that is not used by other parts of the program. The <a class="el" href="classstefanfrings_1_1HttpSessionStore.html" title="Stores HTTP sessions and deletes them when they have expired.">HttpSessionStore</a> does not take over ownership of the QSettings instance, so the caller should destroy it during shutdown. </td></tr>
    <tr><td class="paramname">parent</td><td>Parent object </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="httpsessionstore_8cpp_source.html#l00012">12</a> of file <a class="el" href="httpsessionstore_8cpp_source.html">httpsessionstore.cpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ab197132dc4713cd647705d09c9f84ba8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab197132dc4713cd647705d09c9f84ba8">&#9670;&nbsp;</a></span>getSession() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> HttpSessionStore::getSession </td>
          <td>(</td>
          <td class="paramtype">const QByteArray&#160;</td>
          <td class="paramname"><em>id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get a HTTP session by it's ID number. </p>
<p>This method is thread safe. </p><dl class="section return"><dt>Returns</dt><dd>If there is no such session, the function returns a null session. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>ID number of the session </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classstefanfrings_1_1HttpSession.html#a195963a20805ad00e0eacd90c0194d84" title="Null sessions cannot store data.">HttpSession::isNull()</a> </dd></dl>

<p class="definition">Definition at line <a class="el" href="httpsessionstore_8cpp_source.html#l00093">93</a> of file <a class="el" href="httpsessionstore_8cpp_source.html">httpsessionstore.cpp</a>.</p>

</div>
</div>
<a id="af8b334fa7cf51e411039f0256eda90d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8b334fa7cf51e411039f0256eda90d6">&#9670;&nbsp;</a></span>getSession() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> HttpSessionStore::getSession </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;&#160;</td>
          <td class="paramname"><em>response</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const bool&#160;</td>
          <td class="paramname"><em>allowCreate</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the session of a HTTP request, eventually create a new one. </p>
<p>This method is thread safe. New sessions can only be created before the first byte has been written to the HTTP response. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">request</td><td>Used to get the session cookie </td></tr>
    <tr><td class="paramname">response</td><td>Used to get and set the new session cookie </td></tr>
    <tr><td class="paramname">allowCreate</td><td>can be set to false, to disable the automatic creation of a new session. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>If autoCreate is disabled, the function returns a null session if there is no session. </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classstefanfrings_1_1HttpSession.html#a195963a20805ad00e0eacd90c0194d84" title="Null sessions cannot store data.">HttpSession::isNull()</a> </dd></dl>

<p class="definition">Definition at line <a class="el" href="httpsessionstore_8cpp_source.html#l00052">52</a> of file <a class="el" href="httpsessionstore_8cpp_source.html">httpsessionstore.cpp</a>.</p>

</div>
</div>
<a id="aaf9147137698db03b322ea93de548fba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaf9147137698db03b322ea93de548fba">&#9670;&nbsp;</a></span>getSessionId()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QByteArray HttpSessionStore::getSessionId </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a> &amp;&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a> &amp;&#160;</td>
          <td class="paramname"><em>response</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the ID of the current HTTP session, if it is valid. </p>
<p>This method is thread safe. </p><dl class="section warning"><dt>Warning</dt><dd>Sessions may expire at any time, so subsequent calls of <a class="el" href="classstefanfrings_1_1HttpSessionStore.html#af8b334fa7cf51e411039f0256eda90d6" title="Get the session of a HTTP request, eventually create a new one.">getSession()</a> might return a new session with a different ID. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">request</td><td>Used to get the session cookie </td></tr>
    <tr><td class="paramname">response</td><td>Used to get and set the new session cookie </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Empty string, if there is no valid session. </dd></dl>

<p class="definition">Definition at line <a class="el" href="httpsessionstore_8cpp_source.html#l00028">28</a> of file <a class="el" href="httpsessionstore_8cpp_source.html">httpsessionstore.cpp</a>.</p>

</div>
</div>
<a id="ace45645f705afa06389fb62b78dcc069"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace45645f705afa06389fb62b78dcc069">&#9670;&nbsp;</a></span>sessionDeleted</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void stefanfrings::HttpSessionStore::sessionDeleted </td>
          <td>(</td>
          <td class="paramtype">const QByteArray &amp;&#160;</td>
          <td class="paramname"><em>sessionId</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">signal</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Emitted when the session is deleted. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sessionId</td><td>The ID number of the session. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>httpserver/<a class="el" href="httpsessionstore_8h_source.html">httpsessionstore.h</a></li>
<li>httpserver/<a class="el" href="httpsessionstore_8cpp_source.html">httpsessionstore.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>stefanfrings</b></li><li class="navelem"><a class="el" href="classstefanfrings_1_1HttpSessionStore.html">HttpSessionStore</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
